package com.cheng.example.atguigu.view2.client27;


/**
 * synchronized方式可重入锁演示
 */
public class Test01 {

    public synchronized void f1() {
        System.out.println(Thread.currentThread().getName()+"\t"+"f1");
        f2();
    }
    public synchronized void f2() {
        System.out.println(Thread.currentThread().getName()+"\t"+"f2");
    }

    public static void main(String[] args) {
        Test01 test01 = new Test01();

        new Thread(()->{
            test01.f1();
        },"t1").start();

        new Thread(()->{
            test01.f1();
        },"t2").start();

    }
}
